exports.functions={
	/*
		Function: functions.save_checkboxlist
	*/
	save_checkboxlist: function(space,name,prefix,name_id,search_filter,create_filter) {
		var all={};
		space.mfact.list(name,search_filter).forEach(function(x) {all[x[name_id]]=x.id;});
		for (var k in space.fields) {
			if (k.substr(0,prefix.length)!=prefix) continue;
			var id=k.substr(prefix.length);
			if (!all[id]) {
				var h=create_filter;
				h[name_id]=id;
				var item=space.mfact.from_object(name,h);
				item.Save();
			}
			delete all[id];
		}
		for (var id in all) {
			space.mfact.del_one(name,all[id]);
		}
	}
};

